<%#
 Copyright 2013-2020 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
jobs:
- job: Test
  pool:
    vmImage: 'Ubuntu 16.04'
  variables:
    NODE_VERSION: <%= NODE_VERSION %>
    SPRING_OUTPUT_ANSI_ENABLED: NEVER
    SPRING_JPA_SHOW_SQL: false
    JHI_DISABLE_WEBPACK_LOGS: true
    NG_CLI_ANALYTICS: "false"

  steps:
<%_ if (!skipClient) { _%>
  #----------------------------------------------------------------------
  # Install all tools and check configuration
  #----------------------------------------------------------------------
  - task: NodeTool@0
    inputs:
      versionSpec: $(NODE_VERSION)
    displayName: 'TOOLS: install Node.js'
<%_ } _%>
  #----------------------------------------------------------------------
  # Tests
  #----------------------------------------------------------------------
<%_ if (!skipClient) { _%>
  - task: Npm@1
    inputs:
      command: 'install'
    displayName: 'INSTALL: launch npm install'
<%_ } _%>
  <%_ if (!skipServer) { _%>
    <%_ if (buildTool === 'maven') { _%>
  - script: |
      chmod +x mvnw
      ./mvnw -ntp checkstyle:check
      ./mvnw -ntp clean verify -P-webpack
  <%_ } else if (buildTool === 'gradle') { _%>
  - script: |
      chmod +x gradlew
      ./gradlew checkstyleNohttp
      ./gradlew clean test integrationTest
    <%_ } _%>
    displayName: 'TESTS: backend'
  <%_ } _%>
<%_ if (!skipClient) { _%>
  - task: Npm@1
    inputs:
      command: 'custom'
      customCommand: 'run <%= frontTestCommand %>'
    displayName: 'TESTS: frontend'
<%_ } _%>
<%_ if (!skipServer) { _%>
  <%_ if (buildTool === 'maven') { _%>
  - script: ./mvnw -ntp verify -Pprod -DskipTests
  <%_ } else if (buildTool === 'gradle') { _%>
  - script: ./gradlew bootJar -Pprod -x test
  <%_ } _%>
    displayName: 'TESTS: packaging'
<%_ } _%>
